//
//  HomeTabView.swift
//  HomeTabView
//
//  Created by Ben on 2021/8/19.
//

import SwiftUI

struct HomeTabView: View {
    
    @EnvironmentObject var homeVM: HomeViewModel

    var body: some View {
        
        GeometryReader { proxy in
            ScrollView(.horizontal, showsIndicators: false) {
                
                TabView(selection: $homeVM.currNavTab) {
                    
                    // 关注的人的动态
                    HomeAttentionView()
                        .tag(HomeNavTab.attention)
                        
                    // 推荐
                    HomeRecommendView()
                        .tag(HomeNavTab.recommend)

                    // 当前定位城市的服务及二手市场
                    HomeLocationView()
                        .tag(HomeNavTab.location)
                }
                .frame(width: proxy.size.width)
            }
            
            .tabViewStyle(.page(indexDisplayMode: PageTabViewStyle.IndexDisplayMode.never))
        }
        .onAppear {
        }
        
    }
}
